package com.lpinfo.spb.transaction;

import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.lpinfo.spb.LpinfoSpbApplicationTests;
import com.lpinfo.spb.plateform.system.entity.SysUser;
import com.lpinfo.spb.plateform.system.service.SysUserService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * kingk
 * Transactional test
 */
@Transactional
@Component
public class TransactionalSuit extends LpinfoSpbApplicationTests {
    @Autowired
    private SysUserService sysUserService;

    @Test
    public void test() {
        Long primaryKey = IdWorker.getId();
        SysUser entity  = new SysUser();
        entity.setUserId(primaryKey);
        entity.setNickName("本地事务测试");
        boolean result =  sysUserService.save(entity);
        int restRooback = 1/0;
    }
}
